home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / infoserv / gopher / Unix / gopher-gateways / techinfo / techinpher / v1.0 / network.h.Z / network.h
Encoding:
C/C++ Source or Header  |  1993-02-01  |  7.8 KB  |  220 lines

  1. /*
  2.  * a header for Techinfo network stuff
  3.  */
  4. /* The top half of this file will need to be modified before compiling the 
  5.    server for a new installation. Also there are other file locations 
  6.    in glob.c */
  7. /* 
  8.  * NOTE:  By default clients do NOT see the a node's flags; in the default
  9.  *  format a zero is sent in place of the flags.  To receive the flags, a 
  10.  *  client must use the 'O' transaction (see below).
  11.  */
  12.  
  13. #define PIPS_PORT    9000
  14. #define PORT            "9000"
  15. #define PIPS_SERVER     "penninfo-srv.upenn.edu"
  16.  
  17. #define SERVER_UID       20061 
  18. #define TI_VERSION      "UNIX:3.1"
  19. #define HELP_PHONE      "(215) 898-2728"
  20. #define HELP_ID          10210
  21.  
  22.  
  23.  
  24. #define BANNER_MSG  101
  25. #define BANNER     "0:TechInpherServer, version 1.0  .\n"
  26. #define NAK_BANNER     "100: The TechInpher Server is temporarily unavailable, please try again later.\n"
  27. #ifndef TEST
  28. /* production locations */
  29. #define  TRANS_LOG    "/var/ti/logs/pips.trans.log"
  30. #define  NEXTID_FILE    "/var/ti/admin/pips.next.id"
  31. #define  PROV_FILE    "/var/ti/admin/pips.providers"
  32. #define  VER_FILE    "/var/ti/admin/pips.versions"
  33. #define  LOCAL_WEB_FILE "/var/ti/admin/pips.web"
  34. #define  PROV_LN_SZ    45
  35. #define  ADMIN_FILE    "/var/ti/admin/pips.admin"
  36. #define  ADMIN_LN_SZ    80
  37. #define  SERVER_FILE       "/var/ti/admin/pips.servers"
  38. #define  SOURCE_FILE       "/var/ti/admin/pips.sources"
  39. #define  SOURCE_FILE_BACKUP       "/var/ti/admin/pips.sources.bak"
  40. #define  TMP_SOURCE_FILE   "/var/ti/admin/pips.sources.tmp"
  41. #define    PIPS_LOCKER    "ti_data"
  42. #else
  43. /* test locations */
  44. #define  TRANS_LOG    "pips.trans.log"
  45. #define  NEXTID_FILE    "pips.next.id"
  46. #define  PROV_FILE    "pips.providers"
  47. #define  VER_FILE    "pips.versions"
  48. #define  LOCAL_WEB_FILE "pips.web"
  49. #define  PROV_LN_SZ    45
  50. #define  ADMIN_FILE    "pips.admin"
  51. #define  ADMIN_LN_SZ    80
  52. #define  SERVER_FILE       "pips.servers"
  53. #define  SOURCE_FILE       "pips.sources"
  54. #define  SOURCE_FILE_BACKUP     "pips.sources.bak"
  55. #define  TMP_SOURCE_FILE   "pips.sources.tmp"
  56. #define     PIPS_LOCKER    "tidata"
  57. #endif
  58.  
  59. /*++++++++  BELOW HERE SHOULD NOT NEED MODIFING +++++++++++++++++++*/
  60.  
  61. #define    CRLF        "\015\012"
  62. #define    EOL        "\012"        /* End of Line */
  63. #define    EOL_LEN        1
  64. #define EOM        ".\015\012"        /* End of Message */
  65. #define EOM_LEN        3
  66. #define EOLM        "\012.\015\012"    /* EOL + EOM */
  67. #define EOLM_LEN    (EOL_LEN + EOM_LEN)
  68.  
  69. #define  MAX_TRANS      500   /* maximum # of trans per session */
  70. #define  SRV_LN_SZ      256
  71. #define  SRC_LN_SZ      256
  72.  
  73. #define  ADV_HELP_ID    22558     /*  old way -- not used */
  74. #define  HELP_MENU_ID   8041     /*  THIS is the one! */
  75.  
  76. #define  NOBODY  -1
  77.  
  78. typedef struct pending_sends TOSEND;
  79. typedef struct pending_recvs TOREC;
  80. typedef struct pending_helper WAITFORHELPER;
  81.  
  82. struct pending_helper
  83. {
  84.   long pid;               /* id of child process */
  85.   char *file;             /* name of child's output file */
  86.  
  87.   /*
  88.     nodeid and gophtype needed because we will move the translated results
  89.     to cachedir/nodeid.gophtype.
  90.     nodeid is also needed because it is the first node when an nlist
  91.     is sent back to the client.
  92.     gophtype is also needed because we need to know HOW to interpret
  93.     the results in the child's output file.
  94.     */
  95.   struct s1 *node;            /* nodeid and gophtype for this send */
  96.  
  97.   /* needed after child exits to decide what to send client */
  98.   long startpoint;        /* what byte to start at --for documents */
  99.   long requested;         /* how much to send --for documents */
  100.  
  101.   /* child needs to know where to put the converted results */
  102.   char *cachefile;
  103. };
  104.  
  105.  
  106. struct pending_sends
  107. {
  108.   char *buf;  /* buffer to free when through */
  109.   char *ptr;  /* pointer to start sending from */
  110.   int  size;  /* how much left to send */
  111.   int  sock;  /* socket to send to */
  112. };
  113.  
  114. struct pending_recvs
  115. {
  116.   char *filename; /* the file name of the file being recvd */
  117.   int  the_fd;    /* the file desc of the open file */
  118.   int  sock;      /* the socket to receive from */
  119. };
  120.  
  121. typedef struct connection    CONN;
  122.  
  123. struct connection {
  124.     int    c_socket;
  125.     char    *c_hostname;
  126.     int    c_portnum;
  127.     int    c_flags;
  128.     char    *c_uid;
  129.         char    *c_type;
  130.     time_t    c_made;
  131.     time_t    c_last;
  132.     TOSEND  *c_ptr;
  133.     TOREC   *c_recptr;
  134.     WAITFORHELPER *c_hptr;     /* Added Jan 1993 LAM */
  135.     int     c_output_fmt;      /* Added 8/12/92 ark */
  136.     int     c_trans_cnt;      /* added 9/118/92 ST */
  137. };
  138.  
  139. #define C_FULLFMT    0x1    /* Using full format output */
  140. #define C_BUSY        0x2    /* connection is already being serviced */
  141. #define C_TIMEOUT    0x4    /* Connection has timed out */
  142. #define C_PROVIDER    0x8    /* Connection is a provider */
  143.  
  144. /* Added 1/93 LAM:
  145.   c_childpid = process id of child getting Gopher data.
  146.   c_gophertype = gopher file type -- so parent knows what 
  147.       output format to expect from its child.
  148.   c_state tells whether child is done getting gopher data.
  149.   */
  150.  
  151. #define MAX_TRANS_FIELDS 31  /* number of DLM separated fields in transaction*/
  152.  
  153.  
  154. /*
  155.  * Transaction codes.
  156.  */
  157.  
  158. #define    T_ADDNODE      'a'    /* add */
  159. #define T_FIND            'b'    /* fnd, find */
  160. #define    T_ENDPROVIDER      'c'    /* epv, */
  161. #define    T_DUMPWEB      'd'    /* dmp, dump */
  162. #define T_EXPAND          'e'    /* exp, expand */
  163. #define    T_GETFILE      'f'    /* fil, file, getfile  */
  164. #define T_REORDER_BEFORE  'g'   /* reorder the child links */
  165. #define T_SOURCE          'h'   /* test of valid source for an id */
  166. #define T_RELOAD          'i'   /* reload the web from disk */
  167. #define T_REORDER_AFTER   'j'   /* reorder the child links */
  168. #define T_FINDKEY         'k'   /* find keyword */
  169. #define    T_ADDLINK      'l'    /* lnk, link */
  170. #define    T_GET_SERVER_INFO 'm'   /* get info on other servers */
  171. #define T_SRC_INFO        'n'   /* get full source info on a node */
  172. #define    T_OUTPUTFMT      'o'    /* fmt -- undocumented */
  173. #define    T_TRYPROVIDER      'p'    /* prv, provider */
  174. #define T_QUIT            'q'   /* quit */
  175. #define    T_REPLACENODE      'r'    /* rpl, replace */
  176. #define    T_SENDNODE      's'    /* get, show? node? */
  177. #define T_SENDFILE        't'    /* sfl, sendfile */
  178. #define    T_RMLINK      'u'    /* ulk, unlink */ 
  179. #define T_VERSION         'v'   /* find current version */
  180. #define T_TRAVERSE        'w'    /* trv, web? trav, traverse */
  181. #define    T_RMNODE      'x'    /* del, delete */
  182. #define T_SAVEWEB         'y'   /* save the web to disk */
  183. #define T_ADMIN           'z'    /* adm, admin */
  184. #define T_CHG_SRC_INFO    'A'   /* change the info about a source 
  185.                    format is A:<source_info_line> */
  186. #define T_SHOW_CONN       'B'    /* show the current connections, an admin cmd*/
  187. #define T_SHUTDOWN        'C'    /* shutdown the server, save web , dont 
  188.                    accept connections, and shutdown when 
  189.                    connections left have been inactive
  190.                    for n minutes */
  191. #define T_CHG_BANNER      'D'    /* change the banner msg */
  192. #define T_SET_DATES       'E'    /* stat all files except those flagged
  193.                  and set the last modified date (admin cmd)*/
  194. #define T_HELP            'H'   /* send the help menu */
  195. #define T_CHGD_SINCE      'I'   /* send the non-menu nodes which have changed
  196.                  since a certain date*/
  197. #define T_FULL_TXT_SEARCH 'J'   /* Perform full-text WAIS search */
  198. #define T_SOURCE_SRCH     'K'   /* Return all nodes of a given source*/
  199. #define T_NODE_FORMAT     'O'   /* Choose nodelist format */
  200. #define T_TITLE_SRCH      'T'   /* return nodes based on title */
  201.  
  202. /*
  203.  * For/From netio.c
  204.  */
  205.  
  206. /* Output codes necessitated by client bugs which crashed when a node's flags 
  207.    field contained values it didn't like.  Thus the default output format 
  208.    zeros out the flags field, while the new and better format sends the flags 
  209.    across.  The format is changed with the 'O' transaction, which supposedly 
  210.    only new clients will do, to request the new format & get the flags.   
  211.    Added 8/12/92 ark */
  212. #define NO_FLAGS_FORMAT          1        /* Zeros out flags field */
  213. #define SEND_FLAGS_FORMAT        2        /* Sends flags unchanged */
  214. #define TELNET_FORMAT            3        /* "Pretty printing" to make 
  215.                          telnet readable */
  216. #define NUM_FORMATS              3
  217. #define DEFAULT_OUTPUT_FORMAT    NO_FLAGS_FORMAT
  218.  
  219.  
  220.